package demo3;
import java.util.Scanner;
import java.util.Arrays;



public class test3 {

    //交换两个数组
    public static int[] swap(int[] array) {
        int[] copy = new int[array.length];
        for(int i = 0; i < array.length; i++) {
            copy[i] = array[i];
        }
        return copy;
    }


    //奇数放到数组后面
    public static void sort(int[] array){
        int left = 0;
        int right = array.length - 1;
        while(left <= right) {
            if(array[left] % 2 == 0) {
                left++;
                continue;
            }
            if(array[right] % 2 != 0) {
                right--;
                continue;
            }
            int tmp = array[left];
            array[left] = array[right];
            array[right] = tmp;
        }
        for(int x : array) {
            System.out.print(x + " ");
        }
        System.out.println();
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] array = new int[n];
        for(int i = 0; i < n; i++) {
            array[i] = scanner.nextInt();
        }
        sort(array);
//        System.out.println(Arrays.toString(swap(array)));
    }
}
